<%@page	import="com.google.appengine.api.blobstore.BlobstoreServiceFactory"%>
<%@page import="com.google.appengine.api.blobstore.BlobstoreService"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%
	BlobstoreService blobstoreService = BlobstoreServiceFactory
			.getBlobstoreService();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>AddStoreItem</title>
<link type="text/css" href="css/upload.css" rel="stylesheet"/>
<script type="text/javascript" src="Upload/Upload.nocache.js"></script>
<script type="text/javascript">

	var numInputs = 0;
	window.onload = function() {
		var container = document.getElementById('container'), file = null, instructions = document.getElementById('instructions');

		addFileInput();
/*	    var dropzone;
		dropzone = document.getElementById("dropzone");
		dropzone.addEventListener("dragenter", dragin, false);
		dropzone.addEventListener("dragleave", dragout, false);
		dropzone.addEventListener("dragover", stopProp, false);
		dropzone.addEventListener("drop", drop, false);*/
	}


	function addFileInput() {
		
		var el = document.createElement('input');
		el.setAttribute('type', 'file');
		el.setAttribute('multiple', 'multiple');
		el.setAttribute('class', 'fileinput');
		el.setAttribute('name', 'files' + numInputs++);
		el.addEventListener('drop', function() {
			instructions.innerHTML += ' Thanks!';
		});
		el.addEventListener('change', function() {
			instructions.innerHTML += ' Yum!';
			el.className += ' hidden'
			addFileInput();
		});
		container.appendChild(el);
	}
</script>
</head>

<body>
	<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
		style="position: absolute; width: 0; height: 0; border: 0"></iframe>

	<form action="<%=blobstoreService.createUploadUrl("/store/addItem")%>"
		method="post" enctype="multipart/form-data">
		<div id="container">
			<div id="instructions">Drag a file here.</div>
		</div>
		<input type="text" name="test" /> <input type="submit" value="Submit" />
		<div id="preview"></div>
	</form>

</body>
</html>